package channels

import "fmt"

func main() {
	c := make(chan int)

	go func() {
		for i := 0; i < 5; i++ {
			c <- i
		}
		//把 close(c) 注释掉，程序会一直阻塞在 for data := range c 那一行
		close(c)
	}()

	for data := range c {
		fmt.Println(data)
	}

	fmt.Println("Finished")
}
